#ifndef B2D_RENDERTEXTURE_H
#define B2D_RENDERTEXTURE_H

#include "RenderTarget.h"
#include "ITexture.h"

NS_B2D_BEGIN


////////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief	Texture render targets allows rendering to an arbitrary number of textures.
////////////////////////////////////////////////////////////////////////////////////////////////////
class B2D_API RenderTexture
	: public RenderTarget
	, public IGraphicsResource
{
public:
	enum { MAX_TEXTURE_ATTACHMENTS = 4 };

protected:
	TexturePtr mTextures[MAX_TEXTURE_ATTACHMENTS];
	size_t mTextureCount;

public:
	RenderTexture(size_t texCount);
	virtual ~RenderTexture(void);

	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// \brief	Gets a texture attachment.
	///
	/// \param	index	Zero-based index of the texture.
	///
	/// \return	null if doesnt exist, the attached texure otherwise.
	////////////////////////////////////////////////////////////////////////////////////////////////////
	TexturePtr getTexture(size_t index) const;
	////////////////////////////////////////////////////////////////////////////////////////////////////
	/// \brief	Gets texture count.
	///
	/// \return	The texture count.
	////////////////////////////////////////////////////////////////////////////////////////////////////
	size_t getTextureCount(void) const { return mTextureCount; }
};

NS_B2D_END

#endif
